def f(map):
    if not map or not map[0]:
        return 0
    row=len(map)
    col=len(map[0])
    dp=[[0]*col for _ in range(row)]
    dp[0][0]=1
    for i in range(1,row):
        dp[i][0]=dp[i-1][0]
    for j in range(1,col):
        dp[0][j]=dp[0][j-1]
    for i in range(1,row):
        for j in range(1,col):
            dp[i][j]=dp[i-1][j]+dp[i][j-1]
    print(dp[row-1][col-1])
    return dp[row-1][col-1]



m=[[1, 0, 0],
[0, 0, 2]]
f(m)